<script setup>
import {ref} from "vue"
const rules = [
    value => {
      console.log(value)
      if (value.length < 22) {
        return "请输入内容"
      }
      return "none"
    }
]


const v = ref("")

const text = ref()

const runRules = () => {
  rules.forEach(rule => {
    let string = rule(v.value);
    if (string === "none") {

    } else {
      text.value = string
    }

  })
}



</script>

<template>
  <view class="b_input">
    <view class="back">
      <input @blur="runRules" placeholder="输入" v-model="v" /><br/>
      <text class="rule_error">{{text === "none" ? "" : text}}</text>
    </view>
  </view>
</template>

<style scoped lang="scss">
.rule_error {
  color: red;
}
</style>